<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateImagesTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //图片表
        Schema::create('images', function (Blueprint $table) {
            $table->increments('id');
            $table->string('filename')->comment('文件名');
            $table->string('display_filename')->nullable()->comment('显示给用户看的名字');
            $table->string('path')->comment('文件存储路径');
            $table->string('size')->comment('文件大小');
            $table->integer('admin_id')->comment('上传的管理员');
            $table->string('category_type')->default('product')->comment('图片类型');
            $table->enum('status', ['enabled', 'disabled'])->default('enabled')->comment('状态');
            $table->integer('sort')->default(0)->nullable()->comment('排序');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('images');
    }
}
